package com.oocl.service.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.oocl.dao.DeliverInfoDao;
import com.oocl.dao.FoodsDao;
import com.oocl.dao.MerchantsDao;
import com.oocl.dao.OrderCommentDao;
import com.oocl.dao.base.BaseDao;
import com.oocl.entity.Clients;
import com.oocl.entity.DeliverInfo;
import com.oocl.entity.Foods;
import com.oocl.entity.Merchants;
import com.oocl.entity.OrderComment;
import com.oocl.service.CartService;
@Service(value="cartService")
public class CartServiceImpl implements CartService {
	@Resource(name="baseDao")
	private BaseDao baseDao;
	@Resource(name="foodsDao")
	private FoodsDao foodsDao;
	@Resource(name="deliverInfoDao")
	private DeliverInfoDao deliverInfoDao;
	@Resource(name="merchantsDao")
	private MerchantsDao merchantsDao;
	@Resource(name="orderCommentDao")
	private OrderCommentDao orderCommentDao;
	
	
	@Override
	@Transactional
	public Foods findFoodByFid(String fid) {
		Foods food = (Foods) baseDao.find(Foods.class, fid);
		return food;
	}


	@Override
	@Transactional
	public List<Foods> findFoodsByIcnumAndType(String icnum, String type) {
		List<Foods> foodsList = foodsDao.findFoodsByIcType(icnum, type);
		return foodsList;
	}


	@Override
	@Transactional
	public List<Foods> findFoodsByFname(String text,String icnum) {
		List<Foods> foods = foodsDao.findFoodsByFname(text,icnum);
		return foods;
	}


	@Override
	public List<Foods> findFoodsByIcnum(String icnum) {
		List<Foods> foods = foodsDao.findFoodsByIcnum(icnum);
		return foods;
	}


	@Override
	public Merchants findMerchantsByIcnum(String icnum) {
		Merchants merchant = merchantsDao.findmerchantsByIcnum(icnum);
		return merchant;
	}


	@Override
	public Clients findClientsByCid(String cid) {
		Clients client = (Clients) baseDao.find(Clients.class, cid);
		return client;
	}


	@Override
	public List<DeliverInfo> findDeliverInfoBy(String cid) {
		List<DeliverInfo> addressList = deliverInfoDao.loadAllDeliverInfoByCid(cid);
		return addressList;
	}


	@Override
	public List<OrderComment> findOrderCommentListByIcnum(String icnum) {
		List<OrderComment> commondList = orderCommentDao.findCommentListByIcnum(icnum);
		return commondList;
	}

	
	

	
	

}
